using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _ReplaceString_.UI;
using Terraria.GameContent.UI.Elements;

namespace _ReplaceString_.UI.Elements;
public class WrapElement<T> : UIBase where T : UIElement
{
	public T Value { get; }
	public WrapElement(T ui)
	{
		Value = ui;
		ui.Width = new(0, 1);
		ui.Height = new(0, 1);
		Append(ui);
	}
}

public class TextWrap : WrapElement<UIText>
{
	public TextWrap(string text) : this(new UIText(text)) { }
	public TextWrap(UIText ui) : base(ui)
	{
		ui.TextOriginX = 0.5f;
		ui.TextOriginY = 0.5f;
		ui.OnUpdate += delegate
		{
			ui.TextColor = ForegroundColor;
		};
	}
}
